package com.huluobo.a2206parkdemo.shop

import androidx.lifecycle.MutableLiveData
import com.huluobo.base.bean.GitBean
import com.huluobo.base.bean.ShopBean
import com.huluobo.base.mvvm.BaseViewModel
import com.huluobo.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

/**
 *  Created by LC on 2024/10/19.
 */
@HiltViewModel
class ShopViewModel @Inject constructor(
    val apiService: ApiService
) : BaseViewModel() {
    val getAllGoodsSuccess by lazy { MutableLiveData<ShopBean>() }
    fun getAllGoods(categoryId: Int, currentPage: Int, pageSize: Int) {
        executeNetwork2(
            { apiService.getAllGoods(categoryId, currentPage, pageSize) },
            getAllGoodsSuccess::postValue
        )
    }

    val getGitSuccess by lazy { MutableLiveData<GitBean>() }
    fun getGit(page: Int, pageSize: Int) {
        executeNetwork3(
            { apiService.getGits(page, pageSize) },
            getGitSuccess::postValue
        )
    }
}